function add_to_cart()
{
    var number = jQuery('[name=number]').val();
    if(number==0){
        number =1;
    }
    var guige = jQuery('[name=guige]').val();
    var goods_id = jQuery('[name=goods_id]').val();
    var attr_ids = jQuery('[name=attr-ids]').val();
    var spac_list = jQuery('.spac-list');

    var goods = new Object();
    goods.number = number;
    goods.guige = guige;
    goods.goods_id   = goods_id;
    goods.attr_ids = attr_ids;
    goods = JSON.stringify(goods);
    if(spac_list.length!==0){
        if(spac_list.length !== attr_ids.split(',').length){
            mui.toast('请选择完整信息！',{ duration:'short', type:'div' });
            return ;
        }
        if( mui('.mui-numbox').numbox().getValue()<=0){
            mui.toast('加入购物车数量不可为0！',{ duration:'short', type:'div' });
            return ;
        }
    }

    jQuery.ajax({

        type: 'POST',

        url: 'flow.php?' ,

        data: {
            step:'add_to_cart',
            goods:goods
        },

        success: function (data){
            var message = eval('('+data+')');
            if(message[0]){
                jQuery('.mui-badge').html(message[1].cartNum
                );
                mui.toast('加入购物车成功',{ duration:'short', type:'div' });
            }

            var guigeAll = document.getElementsByClassName('guige');
            for(var i =0,pl= guigeAll.length;i<pl;i++) {
                guigeAll[i].style.border= '';
            }
            var inputId= document.getElementById('guige-genaral');
            var attrIds= document.getElementById('attr-ids');
            inputId.value = '';
            attrIds.value = '';
            mui('.mui-numbox').numbox().setValue(1);

            jQuery('#picture').removeClass('mui-active');
            jQuery('.mui-backdrop').remove();console.log(data);

        },

        dataType: JSON

    });
}